package components
{
	import UIFree.ObjectEvent;
	import UIFree.uif_component;
	
	import flash.geom.Rectangle;

	public class clt_selectBase extends clt_box {
		private var _previewURL		: String;
		private var _selectEvent	: String;
		public function clt_selectBase(parent:uif_component, a_dataModule:Object, a_previewURL: String, a_selectEvent: String,
							ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, countInfo:Boolean=true) {
			_previewURL		= a_previewURL;
			_selectEvent	= a_selectEvent;
			super(parent, a_dataModule, ax, ay, awidth, aheight, 0, 'tabBox', countInfo);
		}
		
		override protected function doItemSelect(e: ObjectEvent): void {
			super.doItemSelect(e);
			if (workspace) workspace.waitEvent(new ObjectEvent(_selectEvent, e.object));
		}
		
		override protected function prepareTabList(a_list: Array): Array {
			return a_list.filter(function(item: Object, i: int, arr: Array): Boolean {
				return !item.hasOwnProperty('hidden') || !item.hidden;
			});
		}
		
		override protected function createListItem(_scroll: uif_component, inner: Rectangle, index: int): clt_previewItem {
			return new clt_previewItem(index, _scroll, inner.x, inner.y, inner.width, inner.height, 
										_filterList[index], style['item_class'], _previewURL);
		}
	}
}